import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";

// 查询参数列表
export function listWorkerInfos(query) {
  return request({
    url: '/workJobApi/list',
    method: 'get',
    params: query
  })
}
// 查询临时工参数列表
export function listWorkerlist(query) {
  return request({
    url: '/workJobApi/listWorkerInfo',
    method: 'get',
    params: query
  })
}

// 修改临时工
export function modifyWorkerInfo(data) {
  return request({
    url: '/workJobApi/modifyWorkerInfo',
    method: 'put',
    data: data
  })
}

// 查询详细
export function getWorker(id) {
  return request({
    url: '/workJobApi/getWorker/' + praseStrEmpty(id),
    method: 'get'
  })
}
//获取用人单位
export function listCompany(query) {
  return request({
      url: '/workJobApi/companyList',
    method: 'get',
    params: query
  })
}
//班次下拉
//获取用人单位
export function listTimShift(query) {
  return request({
    url: '/workJobApi/timeShiftList',
    method: 'get',
    params: query
  })
}
//信息导出
export function exportWorkerInfos(query) {
  return request({
    url: '/workJobApi/export',
    method: 'get',
    params: query
  })
}

export function changeWorkerStatus(workerId, status) {
  const data = {
    workerId,
    status
  }
  return request({
    url: '/workJobApi/changeStatus',
    method: 'put',
    data: data
  })
}
export function changeWorkStatus(orderCode,status) {
  const data ={
    orderCode,
    status
  }
  return request({
    url: '/workJobApi/changeWorkStatus',
    method: 'put',
    data: data
  })
}
export function getImg(workerId) {
  return request({
    url: '/workJobApi/getImg/'+ workerId,
    method: 'get'
  })
}
export function delWorker(id) {
  return request({
    url: '/workJobApi/delWorker/' + id,
    method: 'delete'
  })
}

// 加入黑名单
export function addBlock(data) {
  return request({
    url: '/workJobApi/addToBlacklist',
    method: 'post',
    data: data
  })
}


// 移出黑名单
export function removeFromBlock(data) {
  return request({
    url: '/termWorkerApi/removeFromBlacklist',
    method: 'post',
    data: data
  })
}

export function listData(query) {
  return request({
    url: '/termWorkerApi/pageBlockWorker',
    method: 'get',
    params: query
  })
}

// 导出登录日志
export function exportBlockWorker(query) {
  return request({
    url: '/termWorkerApi/exportBlockWorker',
    method: 'get',
    params: query
  })
}
